package org.gitos.test.client;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

import org.gitos.cloud.domain.tcp.Bucket;

/**
 * TcpEncoder
 *
 * @author purely
 * @date 2015/12/4
 */
public class TcpEncoder extends MessageToByteEncoder<Bucket> {
    @Override
    protected void encode(ChannelHandlerContext ctx, Bucket msg, ByteBuf out) throws Exception {
        byte[] frame = msg.toFrame();
        out.writeBytes(frame);
    }
}
